<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 数组解构
        let arr = [1,2,3];
        let [a,b,c] = arr;
        console.log(a,b,c); // 1,2,3

        // 解构对象
        let person = {
            name: 'jack',
            age: 21,
            language: ['java','js','css']
        };
        // const {name, age, language} = person;
        // console.log(name, age, language); // jack, 21, ['java','js','css']

        // 取别名
        const {name:abc, age, language} = person;
        console.log(abc, age, language); // jack, 21, ['java','js','css']

        // 字符串扩展
        let str = "hello.vue";
        console.log(str.startsWith("hello")); // true
        console.log(str.endsWith(".vue")); // true
        console.log(str.includes("e")); // true

        // 字符串模板
        let ss = `<div>
                <span>hello world</span>
            </div>`;
        console.log(ss);

        // 字符串插入变量和表达式。变量名写在 ${}中，${}中可以放入JavaScript表达式

        function func() {
            return "this is a function"
        }

        let info = `我是${abc}, 今年${age}了, 我想说： ${func()}`;
        console.log(info);


    </script>
</body>
</html>